package com.example.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mapper.AircraftMapper;
import com.example.pojo.Aircraft;
import com.example.service.AircraftService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AircraftServiceImpl extends ServiceImpl<AircraftMapper, Aircraft> implements AircraftService {
    @Autowired
    private AircraftMapper aircraftMapper;

    @Override
    public List<Aircraft> selectAllAircraft(String originName, String destinationName, Integer start, Integer pageSize) {
        return aircraftMapper.selectAllAircraft(originName, destinationName, start, pageSize);
    }

    @Override
    public int count(String originName,String destinationName) {
        return aircraftMapper.count(originName, destinationName);
    }

    @Override
    public int addAircraft(Aircraft aircraft) {
        return aircraftMapper.insert(aircraft);
    }

    @Override
    public int deleteAircraft(Integer id) {
        return aircraftMapper.deleteById(id);
    }

    @Override
    public Aircraft selectById(Integer id) {
        return aircraftMapper.selectById(id);
    }

    @Override
    public int updateAircraft(Aircraft aircraft) {
        return aircraftMapper.updateById(aircraft);
    }

    @Override
    public void addAircraft(List<Aircraft> aircrafts) {
        saveBatch(aircrafts);//批量添加
    }
}
